package bootstrap

import (
	"dan/bootstrap/api"
	"dan/bootstrap/config"
	"dan/utils/tools"
	"errors"
	"github.com/spf13/cobra"
	"os"
)

var rootCmd = &cobra.Command{
	Use: "dan",
	Short: "dan",
	SilenceUsage: true,
	Long: "dan",
	Args: func(cmd *cobra.Command, args []string) error {
		if len(args) < 1 {
			return errors.New(tools.Red("requires at least one arg"))
		}
		return nil
	},
	PersistentPostRunE: func(cmd *cobra.Command, args []string) error {
		return nil
	},
	Run: func(cmd *cobra.Command, args []string) {

	},
}

func init() {
	rootCmd.AddCommand(api.StartCmd)
	rootCmd.AddCommand(config.StartCmd)
}

func Run()  {
	if err := rootCmd.Execute(); err != nil {
		os.Exit(-1)
	}
}
